X-Git-Url: https://git.r.bdr.sh/rbdr/super-polarity/blobdiff_plain/63a61ee2be3a902c27cd000d41b1a3a0280be21a..2af83e98005a14c439b360a5b9ac636f594d9f0c:/Super%20Polarity/SuperPolarity.cs
diff --git a/Super Polarity/SuperPolarity.cs b/Super Polarity/SuperPolarity.cs
index 40f1477..b590079 100644
--- a/Super Polarity/SuperPolarity.cs
+++ b/Super Polarity/SuperPolarity.cs
@@ -17,16 +17,16 @@ namespace SuperPolarity
///
public class SuperPolarity : Game
{
- GraphicsDeviceManager graphics;
+ public static GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;
- MainShip player;
-
public SuperPolarity()
: base()
{
- graphics = new GraphicsDeviceManager(this);
+ SuperPolarity.graphics = new GraphicsDeviceManager(this);
+ SuperPolarity.graphics.PreferMultiSampling = true;
Content.RootDirectory = "Content";
+ ActorFactory.SetGame(this);
}
///
@@ -37,9 +37,13 @@ namespace SuperPolarity
///
protected override void Initialize()
{
- player = new MainShip();
-
base.Initialize();
+
+ InputController.RegisterEventForButton("changePolarity", Buttons.A);
+ InputController.RegisterEventForKey("changePolarity", Keys.Z);
+
+ InputController.RegisterEventForButton("shoot", Buttons.X);
+ InputController.RegisterEventForKey("shoot", Keys.X);
}
///
@@ -53,7 +57,9 @@ namespace SuperPolarity
Vector2 playerPosition = new Vector2(GraphicsDevice.Viewport.TitleSafeArea.X, GraphicsDevice.Viewport.TitleSafeArea.Y + GraphicsDevice.Viewport.TitleSafeArea.Height / 2);
- player.Initialize(Content.Load("Graphics\\player"), playerPosition);
+ ActorFactory.CreateShip(Ship.Polarity.Positive, new Vector2(200, 200));
+ ActorFactory.CreateShip(Ship.Polarity.Negative, new Vector2(400, 200));
+ ActorFactory.CreateMainShip(playerPosition);
}
///
@@ -77,6 +83,9 @@ namespace SuperPolarity
// TODO: Add your update logic here
+ InputController.UpdateInput();
+ ActorManager.Update(gameTime);
+
base.Update(gameTime);
}
@@ -86,11 +95,11 @@ namespace SuperPolarity
/// Provides a snapshot of timing values.
protected override void Draw(GameTime gameTime)
{
- GraphicsDevice.Clear(Color.CornflowerBlue);
+ GraphicsDevice.Clear(Color.White);
spriteBatch.Begin();
- player.Draw(spriteBatch);
+ ActorManager.Draw(spriteBatch);
spriteBatch.End();